package com.atguigu.daijia.customer.client;

import com.atguigu.daijia.common.result.Result;
import com.atguigu.daijia.common.result.ResultCodeEnum;
import com.atguigu.daijia.model.form.customer.UpdateWxPhoneForm;
import com.atguigu.daijia.model.vo.customer.CustomerLoginVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.TreeSet;

/**
 * @author 山顶洞人郑某
 * @className CustomerInfoFeignClientFallback.java
 * @date 2024 09 04
 */
@Component
@Slf4j
public class CustomerInfoFeignClientFallback implements FallbackFactory<CustomerInfoFeignClient> {
    @Override
    public CustomerInfoFeignClient create(Throwable cause) {
      return new CustomerInfoFeignClient() {
          @Override
          public Result<Long> login(String code) {
              return Result.fail();
          }

          @Override
          public Result<CustomerLoginVo> getCustomerLoginVo(Long userId) {
              return Result.fail();
          }

          @Override
          public Result<Boolean> updateWxPhoneNumber(UpdateWxPhoneForm updateWxPhoneForm) {
              log.error("远程调用更新手机号失败,用户id:{}",updateWxPhoneForm.getCustomerId());
              return Result.fail();
          }
      };
    }
}
